package org.example.entity;

/**
 * 活动类
 *
 * @author 12877
 */
public class Discounts {

    Supermarket supermarket = new Supermarket();
    Apple apple = new Apple(8);
    Strawberry strawberry = new Strawberry(13);
    Mango mango = new Mango(20);

    /**
     * 商品总价
     */
    public double getTotalPrice(int appleQuantity,int strawberryQuantity,int mangoQuantity){
        double appleTotalPrice = apple.getTotalPrice(appleQuantity);
        double strawberryTotalPrice = strawberry.getTotalPrice(strawberryQuantity);
        double mangoTotalPrice = mango.getTotalPrice(mangoQuantity);
        double TotalPrice = appleTotalPrice+strawberryTotalPrice+mangoTotalPrice;
        return TotalPrice;
    }
    /**
     * 优惠活动1：草莓限时打 8 折。
     * @param appleQuantity
     * @param strawberryQuantity
     * @param mangoQuantity
     * @return
     */
    public double discounts1TotalPrice(int appleQuantity,int strawberryQuantity,int mangoQuantity) {
        double appleTotalPrice = apple.getTotalPrice(appleQuantity);
        double strawberryTotalPrice = strawberry.getTotalPrice(strawberryQuantity) * 0.8;
        double mangoTotalPrice = mango.getTotalPrice(mangoQuantity);
        double TotalPrice = appleTotalPrice+strawberryTotalPrice+mangoTotalPrice;
        return TotalPrice;

    }
    /**
     优惠活动2：购物满 100 减 10 块。
     * @author 12877
     */
    public double discounts2TotalPrice(int appleQuantity,int strawberryQuantity,int mangoQuantity) {
        double totalPrice = getTotalPrice(appleQuantity, strawberryQuantity, mangoQuantity);
        if (totalPrice >= 100) {
            totalPrice -= 10; // 满100减10块
        }
        return totalPrice;

    }

}
